var page = 1;
    var form = getUrlParam('form');
    if (form == 'index') {
        getClassiDataindex(page);
        $(".caption").text('热卖推荐');
    } else {
        getClassiData(page);
        $(".caption").text(getUrlParam('protype_name'));
    }

    console.log(getUrlParam('protype_name'));

    function getClassiData(page) {
        var id = getUrlParam('id');
        $.ajax({
            type: "get",
            url: Url + "typeproduct/" + id + '/page/' + page,
            async: false,
            timeout : 20000,
            beforeSend: function (xhr) {
                showDiv()
            },
            success: function (data) {
                hiddenDiv()
                console.log(data)
                if (data.allList == data.requestList) {
                    taostr("没有更多了", 2000)
                }
                if (data.allList == 0) {
                    $(".discount-main-no").css("display", "block")
                } else {
                    setClassiData(data)
                }
            },
            error: function (request, status, err) {
                failure(status)
            }
        });
    }

    function getClassiDataindex(page) {
        var id = getUrlParam('id');
        $.ajax({
            type: "get",
            url: Url + "ClassiList/" + id + '/page/' + page,
            async: false,
            timeout : 20000,
            beforeSend: function (xhr) {
                showDiv()
            },
            success: function (data) {
                hiddenDiv()
                console.log(data)
                if (data.allList == data.requestList) {
                    taostr("没有更多了", 2000)
                }
                if (data.allList == 0) {
                    $(".discount-main-no").css("display", "block")
                } else {
                    setClassiData(data)
                }
            },
            error: function (request, status, err) {
                failure(status)
            }
        });
    }

    function setClassiData(data) {
        var str = '';
        for (var i = 0; i < data.data.length; i++) {
            str += '<div class="single-goods">'
                + '<a href="goods_detail?id=' + data.data[i].products_id + '">'
                + '<img class="avatar" src="' + data.data[i].img.pimg_url + '" mode="aspectFill" />'
                + '<div class="writtenWords">'
                + '<div class="title">' + data.data[i].products_name + '</div>'
                + '<div class="price">￥' + data.data[i].products_sellingprice + '</div>'
                + '</div>'
                + '</a>'
                + '</div>';
        }
        $(".main-goods").html(str)
    }

    slideDown("#main", 61, function (e) {
        var that = this;
        if (form == 'index') {
            getClassiDataindex(1);
        } else {
            getClassiData(1);
        }
        that.back.call();

    });
    slideUp("#main", 61, function (e) {

        var that = this;
        page++;
        if (form == 'index') {
            getClassiDataindex(page);
        } else {
            getClassiData(page);
        }
        that.backup.call();
    });
